export default [
	{
		path: "/",
		redirect: "/home",
	},
	{
		name: "home",
		path: "/home",
		component: () => import("@/views/Home"),
		meta: { showFooter: true, showTypeNavList: true },
	},
	{
		name: "search",
		path: "/search/:keyword?",
		component: () => import("@/views/Search"),
		meta: { showFooter: true, showTypeNavList: false },
	},
	{
		name: "detail",
		path: "/detail/:skuId?",
		component: () => import("@/views/Detail"),
		meta: { showFooter: true, showTypeNavList: false },
	},
	{
		name: "addCart",
		path: "/addCart",
		// path: "/addCart/:skuInfo?/:skuNum?",
		component: () => import("@/views/AddCartSuccess"),
		meta: { showFooter: true },
	},
	{
		name: "shopCart",
		path: "/shopCart",
		component: () => import("@/views/ShopCart"),
		meta: { showFooter: true },
	},

	// 登录 注册
	{
		path: "/login",
		component: () => import("@/views/Login"),
		meta: { showFooter: false },
	},
	{
		path: "/register",
		component: () => import("@/views/Register"),
		meta: { showFooter: false },
	},
	// 订单
	{
		path: "/trade",
		component: () => import("@/views/Trade"),
		meta: { showFooter: true },
		beforeEnter: (to, from, next) => {
			// 如果是从shopCart来的 放行
			if (from.path == "/shopCart") {
				next();
			} else {
				next(false); // 不是shopCart来的，一律打回原籍
			}
		},
	},
	{
		path: "/pay",
		component: () => import("@/views/Pay"),
		meta: { showFooter: true },
		beforeEnter(to, from, next) {
			if (from.path == "/trade") {
				next();
			} else {
				next(false);
			}
		},
	},
	{
		path: "/paySuccess",
		component: () => import("@/views/PaySuccess"),
		meta: { showFooter: true },
		beforeEnter(to, from, next) {
			if (from.path == "/pay") {
				next();
			} else {
				next(false);
			}
		},
	},
	{
		path: "/center",
		component: () => import("@/views/Center"),
		meta: { showFooter: true },
		redirect: "/center/myOrder",

		children: [
			{
				path: "myOrder",
				component: () => import("@/views/Center/MyOrder"),
			},
			{
				path: "teamOrder",
				component: () => import("@/views/Center/TeamOrder"),
			},
		],
	},
];
